package com.rockxin.cat.base;

import android.content.Context;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;

import com.fuiou.mobile.FyPay;
import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.Logger;
import com.rockxin.cat.utils.ToastUtils;
import com.rockxin.cat.utils.Utils;
import com.squareup.leakcanary.LeakCanary;

/**
 * 2017-2-27
 */
public class BaseApplication extends MultiDexApplication {
    private static final String TAG = "BaseApplication";
    private static BaseApplication baseApplication;

    @Override
    public void onCreate() {
        super.onCreate();
        baseApplication = this;
        initLeakCanary();
        //初始化Toast
        ToastUtils.init(true);
        Utils.init(this);
        Logger.addLogAdapter(new AndroidLogAdapter());
    }

    private void initLeakCanary() {
        if (LeakCanary.isInAnalyzerProcess(this)) {
            // This process is dedicated to LeakCanary for heap analysis.
            // You should not init your app in this process.
            return;
        }
        LeakCanary.install(this);
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

}
